//////////////////////////////////////////////////////////////////////////
//
// Vector Graph Core2D
//
// Module:
//        Move2D.cs
//
// Description:
//        Implementation of move operation
//
// Author:
//        Created on 2008.04.17 by Destrayer
//
//////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;

namespace VectorGraph.Core2D
{
    class Move2D
    {
        public static void Move(ref Point2d pt, Point2d v)
        {
            pt.X += v.X;
            pt.Y += v.Y;
        }

        public static void Move(ref Rectangle2d rect, Point2d v)
        {
            Move2D.Move(ref rect.LeftBottom, v);
            Move2D.Move(ref rect.RightTop, v);
        }

        public static void Move(ref Beeline2d bl, Point2d v)
        {
            Move2D.Move(ref bl.BasePt, v);
        }

        public static void Move(ref Circle2d c, Point2d v)
        {
            Move2D.Move(ref c.CenterPt, v);
        }

        public static void Move(ref Segment2d seg, Point2d v)
        {
            Move2D.Move(ref seg.StartPt, v);
            Move2D.Move(ref seg.EndPt, v);
        }

        public static void Move(ref Arc2d arc, Point2d v)
        {
            Move2D.Move(ref arc.CenterPt, v);
        }

        public static void Move(ref Path2d path, Point2d v)
        {
            for (int i = 0; i < path.Count; i++)
            {
                Point2d pt = path.Vertex(i);
                Move2D.Move(ref pt, v);
                path.SetVertex(i, pt);
            }
        }

        public static void Move(ref Polygon2d poly, Point2d v)
        {
            for (int i = 0; i < poly.Count; i++)
            {
                Point2d pt = poly.Vertex(i);
                Move2D.Move(ref pt, v);
                poly.SetVertex(i, pt);
            }
        }
    }
}
